<template>
  <div class="bid-info">
      <h3>
        应标确认
      </h3>
      <div class="info-div">
        <el-table :data="tableData" border>
            <el-table-column label="操作" align="center" width="100px">
                <template slot-scope="scope">
                    <el-button type="text" @click="priceSubmit(scope.row.id)" v-if="scope.row.bondPayStatus===1 && scope.row.confirmBondStatus===0">收款确认</el-button>
                </template>
            </el-table-column>
            <el-table-column label="供应商编码" align="center" prop="vendorCode" width="100px"></el-table-column>
            <el-table-column label="供应商名称" align="left" prop="vendorName" width="180px"></el-table-column>
            <el-table-column label="标书费" align="center" prop="bondMoney"></el-table-column>
            <el-table-column label="联系电话" align="center" prop="mobilePhone"></el-table-column>
            <el-table-column label="应标状态" align="center" prop="responseStatus">
                <template slot-scope="scope">
                    <TableIcon
                    :flag="scope.row.responseStatus"
                    :titles="[{status:0,title:'未应标'},{status:1,title:'已应标'}]"></TableIcon>
                </template>
            </el-table-column>
            <el-table-column label="保证金付款" align="center" prop="responseStatus">
                <template slot-scope="scope">
                    <TableIcon
                    :flag="scope.row.bondPayStatus"
                    :titles="[{status:0,title:'未付款'},{status:1,title:'已付款'}]"></TableIcon>
                </template>
            </el-table-column>
            <el-table-column label="保证金付款凭证" align="center" prop="bondPayFileName" width="140px">
                <template slot-scope="scope">
                    <a href="javascript:;" @click="downloadFile(scope.row.bondPayFileName,scope.row.bondPayFilePath)" class="download_color">{{scope.row.bondPayFileName}}</a>
                </template>
            </el-table-column>
            <el-table-column label="保证金付款确认" align="center" prop="responseStatus" width="120px">
                <template slot-scope="scope">
                    <TableIcon
                    :flag="scope.row.confirmBondStatus"
                    :titles="[{status:0,title:'未确认'},{status:1,title:'已确认'}]"></TableIcon>
                </template>
            </el-table-column>
            <el-table-column label="投标状态" align="center" prop="responseStatus">
                <template slot-scope="scope">
                    <TableIcon
                    :flag="scope.row.quoteStatus"
                    :titles="[{status:0,title:'未投标'},{status:1,title:'已投标'}]"></TableIcon>
                </template>
            </el-table-column>
            <el-table-column label="定标状态" align="center" prop="winStatus">
                <template slot-scope="scope">
                    <TableIcon
                    :flag="scope.row.winStatus"
                    :titles="[{status:0,title:'未中标'},{status:1,title:'已投标'}]"></TableIcon>
                </template>
            </el-table-column>
        </el-table>
      </div>
  </div>
</template>
<script>
  import TableCell from '@/components/common/table-ext/table-cell';
  import TableIcon from '@/components/common/table-ext/table-icon';
  export default {
    components: {
        TableIcon
    },
    data() {
      return {
          tableData:[]
      };
    },
    created(){
       this.getList();
    },
    methods: {
        getList(){
            this.axios.post(`${this.lib.config.host.bidtender}/bidmgt/view/queryVendors/${this.$attrs.data.id}`).then((res) => {
                this.tableData=res.data;
            })
            .catch(function (error) {
                console.log(error);
            });
        },
        priceSubmit(id){
            this.$confirm('确认收款?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.axios.post(`${this.lib.config.host.bidtender}/bidmgt/bid/confirmCashDepositPay/${id}`).then((response)=>{
                    this.$message({
                        type: 'success',
                        message: '已确认收款!'
                    });
                    this.$emit('initList');
                });
            }).catch(() => {
            });
        },
        // 下载附件
        download(filePath, fileName) {
            this.downloadFile(filePath, fileName);
        }
    }
  }

</script>
